<html>
<meta charset="utf-8">
<title>投诉建议</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="icon" type="image/png" href="assets/common/i/favicon.ico"/>
<meta name="apple-mobile-web-app-title" content="小程序商城"/>
<link rel="stylesheet" href="assets/h5/font-awesome/css/font-awesome.min.css"/>
<link rel="stylesheet" href="assets/h5/css/admin.css"/>
<link rel="stylesheet" href="assets/h5/layui/css/layui.css"/>
<link rel="stylesheet" href="assets/h5/font-awesome/css/font-awesome.min.css" media="all"/>

<style>
    .layui-card-header {
        text-align: center;
    }
</style>
<div class="layui-col-md12">
    <div class="layui-card">
        <div class="layui-card-header">投诉建议</div>
    </div>
</div>
<br>
<!--//内容开始-->
<body>
<form class="layui-form" method="post" action="" style="width: 80%">
    <div class="layui-form-item">
        <label class="layui-form-label">姓名：</label>
        <div class="layui-input-block">
            <input type="text" name="username" id="username" lay-verify="title" autocomplete="off" placeholder="请输入您的称呼"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">电话：</label>
        <div class="layui-input-block">
            <input type="text" name="mobile" id="mobile" lay-verify="title" autocomplete="off" placeholder="请输入您的联系方式"
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">选择类别</label>
        <div class="layui-input-block">
            <select name="interest" lay-filter="liebie" id="liebie">
                <option value="10" selected="">投诉</option>
                <option value="20">建议</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">内容：</label>
        <div class="layui-input-block">
            <textarea placeholder="我们认真聆听您的建议！" class="layui-textarea" name="content" id="content"></textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="admin" style="background: #2D64B3"
                    onclick="check()">立即提交
            </button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script src="assets/h5/layui/layui.js"></script>
<script src="assets/h5/jquery/jquery.min.js"></script>
<script>
    layui.use('form', function () {
        var form = layui.form;
        form.render();
    });
</script>
<script>
    layui.use(['layer', 'form'], function () {
        var layer = layui.layer,
            $ = layui.jquery,
            form = layui.form;
        $(window).on('load', function () {
            form.on('submit(admin)', function () {
                var mobile = $('#mobile').val();
                var username = $('#username').val();
                var liebie = $('#liebie').val();
                var content = $('#content').val();
                $.ajax({
                    url: "{:url('h5/suggest/add')}",
                    data: {'mobile': mobile, 'username': username, 'liebie': liebie, 'content': content},
                    type: 'post',
                    async: false,
                    success: function (res) {
                        if (res.code == 1) {
                            layer.alert(res.msg, function(index){
                                location.href = res.url;
                            })
                        } else {
                            layer.msg(res.msg);
                        }
                    }
                })
                return false;
            });
        });
    });
</script>


</body>
</html>
